home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / System / lpDaemon SRC / README Source < prev    next >
Encoding:
Text File  |  1993-03-30  |  2.7 KB  |  61 lines  |  [TEXT/KAHL]

  1. Some Explanatory Notes for the Sources of lpDaemon
  2. ==================================================
  3.  
  4. Firstly, unless otherwise stated all sources are the work of Casper A. Boon who
  5. holds the copyright to same.  Sources are provided "as is" and no claim is made
  6. as to the suitability for any purpose.
  7.  
  8. Now that that is over and done with,  the processing in lpDaemon is based around
  9. the typical Macintosh event loop.  The code in BackGrounder.C is used to maintain
  10. access to the event loop while waiting for asychronous calls to complete.  The
  11. usual way this is used is for asychronous device manager calls where the ioResult
  12. field is used to detirmine when the call is complete.
  13.  
  14. There are three main routines in the backgrounding :
  15.  
  16.     Ptr Background(integer *flag, CallBackProcPtr proc, Ptr param);
  17.     Ptr Timeout(integer *flag, CallBackProcPtr proc, Ptr param, LongInt timeout);
  18.  
  19.     void RunBackground(void);
  20.  
  21. When an asychronous call is made either Background or Timeout is used to add to the
  22. background queue.  The flag would be the ioResult field.  The proc will be a routine
  23. to call when the value at flag is <= 0.  The param field is a parameter to be passed
  24. to the proc and is usually a pointer to a record structure.  The timeout value may be
  25. given as the number of ticks before the call "times out" and proc is called anyway.
  26. The CallBackProc would not be run at interrupt time and so is not restricted in the
  27. same way that the CompletionProc is.  It will be a routine of the form :
  28.  
  29.             void CallBackProc(integer flag, Ptr param);
  30.  
  31. The flag that is passed is the dereferenced flag pointer passed to the backgrounder
  32. but may still be > 0 which indicates that a timeout has occurred.  This is
  33. useful for spinning cursors etc without killing the asynchronous call.
  34.  
  35. The RunBackground routine is called in the main event loop.  It runs down a queue of
  36. background tasks and checks the dereferenced flags looking for completed calls (when
  37. the value is <= 0 the call is thought to be complete) and checks the timeouts looking
  38. for timed out calls.  If a background task has completed or timed out it is removed
  39. from the background queue and the callback routine is called.
  40.  
  41.  
  42. The PAP interface code
  43. ======================
  44. With thanks to Mike Schuster whose article in MacTutor showed how to access the PAP
  45. code in the LaserWriter.  Also thanks to the CAP team for their PAP code and
  46. printer access code.
  47.  
  48.  
  49.  
  50. Text to PostScript conversion
  51. =============================
  52. An extra file textps.c is included which is a modified version of the textps.c from the
  53. unix lprps package by James Clark (jjc@jclark.com)  To enable the text to postscript
  54. conversion just add :
  55.  
  56. #define TEXTPS
  57.  
  58. to the prefix option in the THINK project.  This has not been tested since it was
  59. re-introduced in this release so, you are on your own.
  60.  
  61.